package com.woniuxy.seataconfig;

import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @Author: 马宇航
 * @Do: seata配置
 * @DateTime: 22/06/07/0007 下午 5:38
 * @Component: 成都蜗牛学苑
 **/
@Configuration
public class DataSourceProxyConfig {
    @Primary
    @Bean
    @ConfigurationProperties(prefix = "spring.datasource")
    public DruidDataSource druidDataSource(){
        return new DruidDataSource();
    }
    @Bean
    public DataSourceProxy dataSource(DruidDataSource dataSource){
        return new DataSourceProxy(dataSource);
    }
}